<template>
  <ul class="tabs">
    <li
      class="tabs-item"
      v-for="(item, index) in list"
      :key="index"
      :class="{ 'tabs-item-active': index === tabsIndex }"
      @click="onSetTabs(index)"
    >
      {{ item }}
    </li>
  </ul>
</template>

<script>
export default {
  name: "TabsView",
  props: {
    tabsIndex: {
      type: Number,
      default: 0,
    },
    list: {
      type: Array,
      default: () => {
        return [];
      },
    },
  },
  data() {
    return {};
  },
  methods: {
    onSetTabs(index) {
      this.$emit("roleType", index);
    },
  },
};
</script>

<style lang="scss" scoped>
.tabs {
  display: flex;
  .tabs-item {
    margin-right: 40px;
    line-height: 40px;
    color: rgba(153, 153, 153, 1);
    cursor: pointer;
    &.tabs-item-active {
      color: #333333 !important;
      border-bottom: 4px solid #34a1e0;
    }
  }
}
</style>